3.1.67 \(\int \frac {\tan ^2(c+d x)}{a+a \sec (c+d x)} \, dx\) [67]

Optimal. Leaf size=21 \[ -\frac {x}{a}+\frac {\tanh ^{-1}(\sin (c+d x))}{a d} \]

[Out]

-x/a+arctanh(sin(d*x+c))/a/d

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 21, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3973, 3855} \begin {gather*} \frac {\tanh ^{-1}(\sin (c+d x))}{a d}-\frac {x}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2/(a + a*Sec[c + d*x]),x]

[Out]

-(x/a) + ArcTanh[Sin[c + d*x]]/(a*d)

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3973

Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Dist[a^(2*n
)/e^(2*n), Int[(e*Cot[c + d*x])^(m + 2*n)/(-a + b*Csc[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && E
qQ[a^2 - b^2, 0] && ILtQ[n, 0]

Rubi steps

\begin {align*} \int \frac {\tan ^2(c+d x)}{a+a \sec (c+d x)} \, dx &=\frac {\int (-a+a \sec (c+d x)) \, dx}{a^2}\\ &=-\frac {x}{a}+\frac {\int \sec (c+d x) \, dx}{a}\\ &=-\frac {x}{a}+\frac {\tanh ^{-1}(\sin (c+d x))}{a d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(60\) vs. \(2(21)=42\).
time = 0.10, size = 60, normalized size = 2.86 \begin {gather*} -\frac {d x+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2/(a + a*Sec[c + d*x]),x]

[Out]

-((d*x + Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]])/(a*d))

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(49\) vs. \(2(21)=42\).
time = 0.07, size = 50, normalized size = 2.38

method result size
risch \(-\frac {x}{a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a d}\) \(49\)
derivativedivides \(\frac {-2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}\) \(50\)
default \(\frac {-2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}\) \(50\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2/(a+a*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

4/d/a*(-1/2*arctan(tan(1/2*d*x+1/2*c))-1/4*ln(tan(1/2*d*x+1/2*c)-1)+1/4*ln(tan(1/2*d*x+1/2*c)+1))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (21) = 42\).
time = 0.49, size = 78, normalized size = 3.71 \begin {gather*} -\frac {\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} + \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+a*sec(d*x+c)),x, algorithm="maxima")

[Out]

-(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a + log(sin(d*x + c)/
(cos(d*x + c) + 1) - 1)/a)/d

________________________________________________________________________________________

Fricas [A]
time = 3.67, size = 35, normalized size = 1.67 \begin {gather*} -\frac {2 \, d x - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+a*sec(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(2*d*x - log(sin(d*x + c) + 1) + log(-sin(d*x + c) + 1))/(a*d)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {\tan ^{2}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2/(a+a*sec(d*x+c)),x)

[Out]

Integral(tan(c + d*x)**2/(sec(c + d*x) + 1), x)/a

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 50 vs. \(2 (21) = 42\).
time = 0.59, size = 50, normalized size = 2.38 \begin {gather*} -\frac {\frac {d x + c}{a} - \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2/(a+a*sec(d*x+c)),x, algorithm="giac")

[Out]

-((d*x + c)/a - log(abs(tan(1/2*d*x + 1/2*c) + 1))/a + log(abs(tan(1/2*d*x + 1/2*c) - 1))/a)/d

________________________________________________________________________________________

Mupad [B]
time = 1.11, size = 25, normalized size = 1.19 \begin {gather*} \frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a\,d}-\frac {x}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^2/(a + a/cos(c + d*x)),x)

[Out]

(2*atanh(tan(c/2 + (d*x)/2)))/(a*d) - x/a

________________________________________________________________________________________